﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ChartDataSet
{
    internal class Chart
    {
        public int ID { get; set; }
        public string Color { get; set; }
        public string ChartType { get; set; }
        public List<DataItem> DataSet { get; set; }

        public Chart()
        {
            DataSet = new List<DataItem>();
        }

        public Chart Clone()
        {
            Chart newChart = new Chart
            {
                ID = this.ID,
                Color = this.Color,
                ChartType = this.ChartType,
                DataSet = new List<DataItem>(this.DataSet)
            };
            return newChart;
        }


        public async Task DisplayAsync()
        {
            Console.WriteLine($"编号:{ID}");
            Console.WriteLine($"颜色:{Color}");
            Console.WriteLine($"图表类型:{ChartType}");
            Console.Write("数据集:");
            foreach (var dataItem in DataSet)
            {
                Console.Write(dataItem.ToString());
            }
            Console.WriteLine("\n-----------------");
        }
    }
}
